package com.anysoft.api;

import com.anysoft.callback.JsonConvert;
import com.anysoft.config.HostConstant;
import com.anysoft.model.ResponseData;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okrx2.adapter.ObservableBody;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;

/**
 * Created by lty on 2018/5/17.
 */

public class ApiFactory {
    /*登录接口*/
    public static Observable<ResponseData<String>> getLoginData(String mobile,String password) {
        Map<String, String> params = new HashMap<>();
        params.put("mobile", mobile);
        params.put("password", password);
        return OkGo.<ResponseData<String>>post(HostConstant.LOGIN)
                .upJson(new Gson().toJson(params))
                .converter(new JsonConvert<ResponseData<String>>() {
                })
                .adapt(new ObservableBody<ResponseData<String>>());
        
    }

}
